/*    */ package dm.jdbc.pool;
/*    */ 
/*    */ import java.sql.SQLException;
/*    */ import javax.sql.ConnectionEvent;
/*    */ import javax.sql.ConnectionEventListener;
/*    */ import javax.sql.DataSource;
/*    */ import javax.sql.PooledConnection;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class DmdbConnectionEventListener_bs
/*    */   implements ConnectionEventListener
/*    */ {
/*    */   static final int CLOSED_EVENT = 1;
/*    */   static final int ERROROCCURED_EVENT = 2;
/*    */   private DataSource dataSource;
/*    */   
/*    */   DmdbConnectionEventListener_bs(DataSource dataSource)
/*    */   {
/* 36 */     this.dataSource = dataSource;
/*    */   }
/*    */   
/*    */   public DmdbConnectionEventListener_bs() {
/* 40 */     this(null);
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   public synchronized void connectionClosed(ConnectionEvent event)
/*    */   {
/* 52 */     if (checkDataSource()) {
/* 53 */       DmdbConnectionCache_bs cache = (DmdbConnectionCache_bs)this.dataSource;
/*    */       try {
/* 55 */         cache.reusePooledConnection(
/* 56 */           (PooledConnection)event.getSource());
/*    */       }
/*    */       catch (SQLException localSQLException) {}
/*    */     }
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   public synchronized void connectionErrorOccurred(ConnectionEvent event)
/*    */   {
/* 72 */     if (checkDataSource()) {
/* 73 */       DmdbConnectionCache_bs cache = (DmdbConnectionCache_bs)this.dataSource;
/*    */       try {
/* 75 */         cache.closePooledConnection(
/* 76 */           (PooledConnection)event.getSource());
/*    */       }
/*    */       catch (SQLException localSQLException) {}
/*    */     }
/*    */   }
/*    */   
/*    */   public void setDataSource(DataSource datasource)
/*    */   {
/* 84 */     this.dataSource = datasource;
/*    */   }
/*    */   
/*    */   public boolean checkDataSource() {
/* 88 */     if ((this.dataSource != null) && 
/* 89 */       ((this.dataSource instanceof DmdbConnectionCache_bs))) {
/* 90 */       return true;
/*    */     }
/* 92 */     return false;
/*    */   }
/*    */   
/*    */   DataSource getDataSource() {
/* 96 */     return this.dataSource;
/*    */   }
/*    */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\jdbc\pool\DmdbConnectionEventListener_bs.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */